package com.yzy.controller;

import com.yzy.dao.DoctorDao;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class DoctorDeleteServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String doctorId;
      DoctorDao dao=new DoctorDao();
      int result=0;
      PrintWriter out=null;
       //1.调用请求对象
        doctorId = request.getParameter("doctorId");
        //2
        result = dao.delete(doctorId);
        //3
        response.setContentType("text/html;charset=utf-8");
        out=response.getWriter();
        if(result ==1){
            out.print("<font style='color:red;font-size:40'>医生信息删除成功</font>");
        }else{
            out.print("<font style='color:red;font-size:40'>医生信息删除失败</font>");
        }
    }
}
